const baseURL = 'https://localhost:3010';

function post(url,data){
	return new Promise((resolve) => {
		uni.request({
			url: baseURL+url,
			data: data,
			method: "POST",
			success(res) {
				resolve(res.data)
			}
		});
	});
}
function get(url){
	return new Promise((resolve) => {
		uni.request({
			url: baseURL+url,
			data: {},
			method: "GET",
			success(res) {
				resolve(res.data)
			}
		});
	});
}
export default{
	async Login(data){
		return await post("/IdentityServer/Login/LoginByEmailAndPwd",data)
	},
	async SendCode(data){
		return await post("/IdentityServer/Login/EmailSend",data)
	},
	async Register(data){
		return await post("/IdentityServer/Login/CreateByEmail",data)
	},
	async LoginByWeChat(code){
		return await get("/IdentityServer/Login/LoginByWeChat?code="+code)
	}
}